From 1a4d42543895a526a1c4e663c89f379f109e8bb1 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 31 Aug 2006 23:44:41 +0100 Subject: [PATCH] [XEN] Clean up BASE_DISALLOW_MASK and fix for x86/64. Original patch from Xiaohui Xin Signed-off-by: Keir Fraser --- xen/include/asm-x86/page.h | 7 ------- xen/include/asm-x86/x86_32/page-2level.h | 3 --- xen/include/asm-x86/x86_32/page-3level.h | 2 -- xen/include/asm-x86/x86_32/page.h | 9 +++++++++ xen/include/asm-x86/x86_64/page.h | 11 +++++++++-- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h index 01ab4be3c7..905d76d576 100644 --- a/xen/include/asm-x86/page.h +++ b/xen/include/asm-x86/page.h @@ -300,13 +300,6 @@ void setup_idle_pagetable(void); #define _PAGE_GNTTAB 0 #endif -/* - * Disallow unused flag bits plus PAT, PSE and GLOBAL. - * Also disallow GNTTAB if we are using it for grant-table debugging. - * Permit the NX bit if the hardware supports it. - */ -#define BASE_DISALLOW_MASK ((0xFFFFF180U | _PAGE_GNTTAB) & ~_PAGE_NX) - #define __PAGE_HYPERVISOR \ (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED) #define __PAGE_HYPERVISOR_NOCACHE \ diff --git a/xen/include/asm-x86/x86_32/page-2level.h b/xen/include/asm-x86/x86_32/page-2level.h index 7f450c4624..e7b74dd18d 100644 --- a/xen/include/asm-x86/x86_32/page-2level.h +++ b/xen/include/asm-x86/x86_32/page-2level.h @@ -53,7 +53,4 @@ typedef l2_pgentry_t root_pgentry_t; #define get_pte_flags(x) ((int)(x) & 0xFFF) #define put_pte_flags(x) ((intpte_t)((x) & 0xFFF)) -#define L1_DISALLOW_MASK BASE_DISALLOW_MASK -#define L2_DISALLOW_MASK BASE_DISALLOW_MASK - #endif /* __X86_32_PAGE_2LEVEL_H__ */ diff --git a/xen/include/asm-x86/x86_32/page-3level.h b/xen/include/asm-x86/x86_32/page-3level.h index e0187478cc..d7d2d19f3f 100644 --- a/xen/include/asm-x86/x86_32/page-3level.h +++ b/xen/include/asm-x86/x86_32/page-3level.h @@ -66,8 +66,6 @@ typedef l3_pgentry_t root_pgentry_t; #define get_pte_flags(x) (((int)((x) >> 32) & ~0xFFF) | ((int)(x) & 0xFFF)) #define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 32) | ((x) & 0xFFF)) -#define L1_DISALLOW_MASK BASE_DISALLOW_MASK -#define L2_DISALLOW_MASK BASE_DISALLOW_MASK #define L3_DISALLOW_MASK 0xFFFFF1E6U /* must-be-zero */ #endif /* __X86_32_PAGE_3LEVEL_H__ */ diff --git a/xen/include/asm-x86/x86_32/page.h b/xen/include/asm-x86/x86_32/page.h index 78d09d1482..228445a62d 100644 --- a/xen/include/asm-x86/x86_32/page.h +++ b/xen/include/asm-x86/x86_32/page.h @@ -26,6 +26,15 @@ extern unsigned int PAGE_HYPERVISOR_NOCACHE; #define GRANT_PTE_FLAGS \ (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_GNTTAB) +/* + * Disallow unused flag bits plus PAT, PSE and GLOBAL. + * Permit the NX bit if the hardware supports it. + */ +#define BASE_DISALLOW_MASK (0xFFFFF180U & ~_PAGE_NX) + +#define L1_DISALLOW_MASK (BASE_DISALLOW_MASK | _PAGE_GNTTAB) +#define L2_DISALLOW_MASK (BASE_DISALLOW_MASK) + #endif /* __X86_32_PAGE_H__ */ /* diff --git a/xen/include/asm-x86/x86_64/page.h b/xen/include/asm-x86/x86_64/page.h index 429cfb8c5d..d323362be9 100644 --- a/xen/include/asm-x86/x86_64/page.h +++ b/xen/include/asm-x86/x86_64/page.h @@ -75,8 +75,15 @@ typedef l4_pgentry_t root_pgentry_t; #define _PAGE_NX_BIT (1U<<23) #define _PAGE_NX (cpu_has_nx ? _PAGE_NX_BIT : 0U) -#define L1_DISALLOW_MASK BASE_DISALLOW_MASK -#define L2_DISALLOW_MASK BASE_DISALLOW_MASK +/* + * Disallow unused flag bits plus PAT, PSE and GLOBAL. + * Permit the NX bit if the hardware supports it. + * Note that range [62:52] is available for software use on x86/64. + */ +#define BASE_DISALLOW_MASK (0xFF000180U & ~_PAGE_NX) + +#define L1_DISALLOW_MASK (BASE_DISALLOW_MASK | _PAGE_GNTTAB) +#define L2_DISALLOW_MASK (BASE_DISALLOW_MASK) #define L3_DISALLOW_MASK (BASE_DISALLOW_MASK | 0x180U /* must-be-zero */) #define L4_DISALLOW_MASK (BASE_DISALLOW_MASK | 0x180U /* must-be-zero */) -- 2.30.2